#include "video_proc.h"

CVideoProc_Arr::CVideoProc_Arr()
{
	m_vecVProc.reserve(2);
}

CVideoProc_Arr::~CVideoProc_Arr()
{

}

int CVideoProc_Arr::Init(int chNums)
{
	int i = 0;
	CVideoProc_1ch tmpProc;

	for(i = 0; i < chNums; i++)
	{
		m_vecVProc.push_back(tmpProc);
	}

	return 0;
}

int CVideoProc_Arr::InitParm(int ch ,int buf_sz)
{
    int ret = 0;

    ret = m_vecVProc[ch].Init(ch,buf_sz);

    return ret;
}

int CVideoProc_Arr::start(int ch)
{
	int ret = 0;
	if(ch >= m_vecVProc.size())
	{
		return ERR_PARAM;
	}


	ret = m_vecVProc[ch].start_video();
	printf("Start video ch %d .\n",ch);

	return ret;
}

int CVideoProc_Arr::startTestFIFO()
{
	int ret = 0;

	ret = m_vecVProc[0].start_test_frame();

	return ret;
}

int CVideoProc_Arr::stop(int ch)
{
	int ret = 0;
	if(ch >= m_vecVProc.size())
	{
		return ERR_OVER_MAX_CHANNEL;
	}

	ret = m_vecVProc[ch].stop_video();

	return ret;
}

int CVideoProc_Arr::read_frame(int ch , unsigned char * buf, int buf_sz,int clientID)
{
	int ret = 0;

	if(ch >= m_vecVProc.size())
	{
		return ERR_OVER_MAX_CHANNEL;
	}

	ret = m_vecVProc[ch].read_frame(buf,buf_sz,clientID);

	return ret;
}

int CVideoProc_Arr::read_nalu(int ch , unsigned char* buf, int buf_sz)
{
	int ret = 0;

	if(ch >= m_vecVProc.size())
	{
		return ERR_OVER_MAX_CHANNEL;
	}

	//ret = m_vecVProc[ch].read_nalu(buf,buf_sz);

	return ret;
}
